#include <iostream>

using namespace std;
using LL=long long;

LL exgcd(LL a,LL b,LL &x,LL &y)
{
	if(!b)
	{
		x=1;
		y=0;
		return a;
	}
	LL d=exgcd(b,a%b,y,x);
	y-=a/b*x;
	return d;
}
int main()
{
	LL a,b,m,n,l,x,y;
	cin>>a>>b>>m>>n>>l;
	LL d=exgcd(m-n,l,x,y);
	if((b-a)%d)
	{
		cout<<"Impossible";
	}
	else{
		x*=(b-a)/d;
		LL t=abs(l/d);
		cout<<(x%t+t)%t<<endl;
	}
	return 0;
}
